<?php
/**
 * @Author: xuzhiyi
 * @Date:   2016-02-16 20:57:18
 * @Last Modified by:   xuzhiyi
 * @Last Modified time: 2016-02-29 16:59:04
 * ------------------------------------------------ *
 * 商品管理                                          *
 * ------------------------------------------------ */

namespace Admin\Controller;
class GoodsController extends CommonController {

public function index(){
		if(IS_AJAX){
			switch(I('ajax')){
				//精品
				case "bestStatus":
					$status = D('Goods')->bestStatus();
					$this->ajaxReturn($status);
					break;
				//推荐
				case "recomStatus":
					$status = D('Goods')->recomStatus();
					$this->ajaxReturn($status);
					break;
				
				//逐个审核
				case "setStatus":
					$status = D('Goods')->setStatus();
					$this->ajaxReturn($status);
					break;

				default:
			 		$result = D('Goods')->getGoods();
			 		$output['data'] = $result;
			 		$this->ajaxReturn($output);
			}
		}

		$this->display();
	}

	public function pend(){
		if(IS_AJAX){
			$result = D('Goods')->getGoodsPendding();
			$output['data'] = $result;
			$this->ajaxReturn($output);
		}

		$this->display();
	}

	public function view(){
		$goods=D('Goods')->getView();
		//dump($goods);
		$this->assign('goods',$goods);
		$this->display();
	}
}